﻿using eService.BLL;
using HLVControl.Grid.Container;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace eService.Presentation
{
    public partial class frmMain : Form
    {
        EnumNameForm.FormMain _giaodien = EnumNameForm.FormMain.BanHang;
        frmBanHang banhang;
        frmNhapKho nhapkho;
        frmDanhMuc danhmuc;
        frmBCPhieuNhap baocao;
        frmNhanVienNguoiDung nguoidung;

        public frmMain()
        {
            InitializeComponent();
            labNguoiDung.Text = StaticVar.user.FullName;
        }
        public frmMain(EnumNameForm.FormMain giaodien)
        {
            InitializeComponent();
            _giaodien = giaodien;
            ChonUI(EnumNameForm.FormMain.DanhMuc);
        }
        private void tileQL_Click(object sender, EventArgs e)
        {
            TextImageTile tile = (TextImageTile)sender;
            string giaodien = tile.Tag.ToString();
            switch (giaodien)
            { 
                case "banhang":
                    ChonUI(EnumNameForm.FormMain.BanHang);
                    break;
                case "quanly":
                    ChonUI(EnumNameForm.FormMain.QuanLy);
                    break;
                case "nguoidung":
                    ChonUI(EnumNameForm.FormMain.NguoiDung);
                    break;
                case "danhmuc":
                    ChonUI(EnumNameForm.FormMain.DanhMuc);
                    break;
                case "baocao":
                    ChonUI(EnumNameForm.FormMain.BaoCao);
                    break;
                case "lienhe":
                    ChonUI(EnumNameForm.FormMain.Lienhe);
                    break;
            }
        }
        private void ChonUI(EnumNameForm.FormMain giaodien)
        {
            //Welcome frmWel = new Welcome();
            //DialogResult res1 = frmWel.ShowDialog();
            //if (res1 == DialogResult.OK)
            //{
            //    
            //}
            switch (giaodien)
            {
                case EnumNameForm.FormMain.BanHang:
                   // banhang.ShowDialog();
                    break;
                case EnumNameForm.FormMain.QuanLy:
                    nhapkho = new frmNhapKho();
                    nhapkho.ShowDialog();
                    break;
                case EnumNameForm.FormMain.DanhMuc:
                    danhmuc = new frmDanhMuc();
                    danhmuc.ShowDialog();
                    break;
                case EnumNameForm.FormMain.BaoCao:
                    //baocao = new frmBCPhieuNhap();
                    //baocao.ShowDialog();
                    break;
                case EnumNameForm.FormMain.NguoiDung:
                    nguoidung = new frmNhanVienNguoiDung();
                    nguoidung.ShowDialog();
                    break;
                case EnumNameForm.FormMain.Lienhe:
                    //----------
                    break;

            }
        }
        private void btnHeThong_Click(object sender, EventArgs e)
        {
            frmCaiDatHeThong hethong = new frmCaiDatHeThong();
            hethong.ShowDialog();
        }
        private void btnThoat_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        private void btnThuNho_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        private void btnDoiMatKhau_Click(object sender, EventArgs e)
        {
            frmThayDoiMatKhau doimatkhau = new frmThayDoiMatKhau();
            doimatkhau.ShowDialog();
        }
    }
}
